Skip to content

Add Playwright e2e tests for the Vue.js renderer#230

Draft
mschuettlerTNG wants to merge 4 commits intodevfrom
cursor/playwright-e2e-tests-cb8f
Draft

Add Playwright e2e tests for the Vue.js renderer#230
mschuettlerTNG wants to merge 4 commits intodevfrom
cursor/playwright-e2e-tests-cb8f

Conversation

@mschuettlerTNG
Copy link
Copy Markdown
Collaborator

@mschuettlerTNG mschuettlerTNG commented Apr 15, 2026

Description:

Adds two tiers of Playwright e2e tests for the application:

  1. Browser integration tests (e2e/, playwright.config.ts) — 54 tests that run the Vue renderer in Chrome with mocked window.electronAPI, validating all UI component rendering and interactions without Electron
  2. Real Electron e2e tests (e2e-real/, playwright-e2e.config.ts) — Tests that launch the actual Electron app via _electron.launch() against a Vite dev server, exercising the real IPC layer, backend service lifecycle, and full app startup flow

Changes Made:

Browser Integration Tests (e2e/)

  • playwright.config.ts — Vite webServer in test mode, Chrome channel
  • e2e/fixtures.tswindow.electronAPI / window.envVars mock injection, appPage + runningAppPage fixtures
  • e2e/app-startup.test.ts (10 tests) — header, title, state transitions
  • e2e/setup-wizard.test.ts (14 tests) — wizard UI, mode selection, backend list, toggles
  • e2e/chat-ui.test.ts (17 tests) — prompt area, history panel, settings sidebar
  • e2e/settings.test.ts (13 tests) — app settings, footer, dev tools

Real Electron E2E Tests (e2e-real/)

  • playwright-e2e.config.ts — Vite webServer (test mode, renderer-only), 5-min test timeout
  • e2e-real/fixtures.tslaunchElectronApp() with env vars, cleanupElectronState() to clear SingletonLock + kill zombie processes, ensureMainProcessCompiled() fallback
  • e2e-real/helpers.tsgetMainWindow() that closes DevTools and finds the http:// renderer window
  • e2e-real/smoke.test.ts (1 test) — verifies Electron launches and renders the AI Playground header
  • e2e-real/app-lifecycle.test.ts (10 tests) — setup wizard, hardware mode selection, backend installation with unsupported backends toggled off, transition to running state, all UI panels, footer toggle, wizard reopen
  • e2e-real/chat-inference.test.ts (7 tests) — model selection, send message, receive streamed response, conversation history

Infrastructure Changes

  • vite.config.mts--mode test skips vite-plugin-electron so the renderer can serve standalone
  • vitest.config.ts — excludes e2e/ and e2e-real/ from Vitest
  • package.json — adds test:e2e, test:e2e:ui, test:e2e:real scripts
  • .gitignore / .prettierignore — Playwright artifacts

Testing Done:

  • npx playwright test — 54/54 browser integration tests pass
  • npx playwright test --config playwright-e2e.config.ts e2e-real/smoke.test.ts — Electron smoke test passes reliably (6/6 consecutive runs)
  • npm run lint:ci — ESLint passes
  • npm run format:ci — Prettier passes
  • npx vitest run — 25/25 unit tests pass (pre-existing failures only)

Note on e2e-real tests: The app-lifecycle.test.ts and chat-inference.test.ts tests are structurally complete but require an environment with network access for backend installation and model downloads. The smoke.test.ts test is fully operational and validates the core Electron launch + renderer integration.

Checklist:

  • I have tested the changes locally.
  • I have self-reviewed the code changes.
  • I have updated the documentation, if necessary.
Open in Web Open in Cursor 

- Install @playwright/test and configure for browser-based e2e testing
- Add vite.config.mts test mode that skips the electron plugin, allowing
  the Vue app to be served in a plain browser with mocked IPC
- Create reusable test fixtures (e2e/fixtures.ts) with comprehensive
  window.electronAPI and window.envVars mocks injected via addInitScript
- Add 54 e2e tests across 4 test files:
  - app-startup.test.ts (10): header, title, state transitions
  - setup-wizard.test.ts (14): wizard UI, mode selection, backend list
  - chat-ui.test.ts (17): prompt area, history panel, settings sidebar
  - settings.test.ts (13): app settings, footer, dev tools
- Add npm scripts: test:e2e and test:e2e:ui
- Exclude e2e/ from vitest to prevent conflicts
- Update .gitignore and .prettierignore for Playwright artifacts

Co-authored-by: Markus Schüttler <mschuettlerTNG@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2fbd72cf-8025-4a6a-bf90-620e847948cd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/playwright-e2e-tests-cb8f

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

cursoragent and others added 3 commits April 15, 2026 22:46
- Create e2e-real/ directory with Playwright tests that launch the real
  Electron app via _electron.launch() against a Vite dev server
- playwright-e2e.config.ts manages the Vite renderer server via webServer
  config (test mode, no electron plugin) while tests launch Electron
  separately with VITE_DEV_SERVER_URL pointed at the dev server
- Shared infrastructure in fixtures.ts (launchElectronApp, ensureMainProcessCompiled)
  and helpers.ts (getMainWindow with DevTools filtering)
- smoke.test.ts: verifies Electron launches and renders the AI Playground header
- app-lifecycle.test.ts (12 serial tests): setup wizard display, hardware
  mode selection, backend installation with Linux-unsupported backends
  toggled off, transition to running state, all UI panels (history,
  app settings, chat settings), footer toggle, wizard reopen
- chat-inference.test.ts (7 serial tests): model selection via chat settings,
  send message and receive streamed response, verify user/assistant messages,
  copy button, follow-up message, conversation in history
- Add test:e2e:real npm script
- Exclude e2e-real/ from vitest

Co-authored-by: Markus Schüttler <mschuettlerTNG@users.noreply.github.com>
- Move DevTools close into getMainWindow helper using evaluate()
- Remove Vite lifecycle management from fixtures (use webServer config)
- Restructure lifecycle test: each test gets its own Electron instance
  via the window fixture for reliability
- Each test handles wizard-to-running transition independently
- Toggle off OpenVINO/ComfyUI (unsupported on Linux) before install

Co-authored-by: Markus Schüttler <mschuettlerTNG@users.noreply.github.com>
- Add cleanupElectronState() that kills leftover Electron processes and
  removes SingletonLock/SingletonSocket/SingletonCookie files before
  each Electron launch to prevent single-instance-lock hangs
- Simplify getMainWindow helper to close DevTools via evaluate() first,
  then poll for the http:// URL window

Co-authored-by: Markus Schüttler <mschuettlerTNG@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants